/**
* @file lcd_dev_GC9A01_spi4_001.c
* @brief HD128006C15 init 
* @details 
* @author huangbin
* @version V1.0.0
* @date 2025-04-25
* @copyright All documents are copyrighted by Shenzhen Xinlongwei Technology Co., LTD.
*            They may not be used for commercial purposes without permission
*/
/*******************************************************************************
HD128006C15: gc9a01,240x240，圆屏
********************************************************************************/  
#include "inc.h"
#include "drv_lcd.h"

static void lcdControlerInit(DRVLCD *pLcd);
void HD128006C15_spi4_001_init(DRVLCD *pLcd)
{
	pLcd->x				= 240;
	pLcd->y				= 240;
	Lcd_RegInterface_Spi4_16(pLcd,0,0);
	pLcd->Reset();
	lcdControlerInit(pLcd);
}
#define LCD_CtrlWrite(reg)	pLcd->WriteIndexReg(reg)
#define LCD_DataWrite(dat)	pLcd->WriteRegParameter(dat)
#define Delay(x) LCD_Delay(x)
static void lcdControlerInit(DRVLCD *pLcd)
{
	LCD_CtrlWrite(0xFE);			 
	LCD_CtrlWrite(0xEF); 

	LCD_CtrlWrite(0xEB);	
	LCD_DataWrite(0x14); 

	LCD_CtrlWrite(0x84);			
	LCD_DataWrite(0x60);//40 

	LCD_CtrlWrite(0x85);
	LCD_DataWrite(0xFF); 

	LCD_CtrlWrite(0x86);            
	LCD_DataWrite(0xFF); 

	LCD_CtrlWrite(0x87);            
	LCD_DataWrite(0xFF);

	LCD_CtrlWrite(0x8E);        
	LCD_DataWrite(0xFF); 

	LCD_CtrlWrite(0x8F);     
	LCD_DataWrite(0xFF); 


	LCD_CtrlWrite(0x88);		
	LCD_DataWrite(0x0A);

	LCD_CtrlWrite(0x89);			
	LCD_DataWrite(0x21); 

	LCD_CtrlWrite(0x8A);			
	LCD_DataWrite(0x00); 

	LCD_CtrlWrite(0x8B);			
	LCD_DataWrite(0x80); 

	LCD_CtrlWrite(0x8C);			
	LCD_DataWrite(0x01); 

	LCD_CtrlWrite(0x8D);			
	LCD_DataWrite(0x03); 

	//LCD_CtrlWrite(0xB5);//add
	//LCD_DataWrite(0x08); 
	// LCD_DataWrite(0x09); 
	// LCD_DataWrite(0x14);
	// LCD_DataWrite(0x08);
	//??
	LCD_CtrlWrite(0xB6);
	LCD_DataWrite(0x00); 
	LCD_DataWrite(0x00); 
	

	LCD_CtrlWrite(0x36);			
	LCD_DataWrite(0x48);

	LCD_CtrlWrite(0x3A);			
	LCD_DataWrite(0x05); 


	LCD_CtrlWrite(0x90);			
	LCD_DataWrite(0x08);
	LCD_DataWrite(0x08);
	LCD_DataWrite(0x08);
	LCD_DataWrite(0x08);
	
	LCD_CtrlWrite(0xBA);			
	LCD_DataWrite(0x01);
	
	LCD_CtrlWrite(0xBD);			
	LCD_DataWrite(0x06);

	LCD_CtrlWrite(0xBC);			
	LCD_DataWrite(0x00);	

	LCD_CtrlWrite(0xFF);			
	LCD_DataWrite(0x60);
	LCD_DataWrite(0x01);
	LCD_DataWrite(0x04);

	LCD_CtrlWrite(0xC3);			
	LCD_DataWrite(0x10);// 15// 1d
	LCD_CtrlWrite(0xC4);			
	LCD_DataWrite(0x10);// 15// 1d

	LCD_CtrlWrite(0xC9);			
	LCD_DataWrite(0x25);

	LCD_CtrlWrite(0xBE);			
	LCD_DataWrite(0x11); 

	LCD_CtrlWrite(0xE1);
	LCD_DataWrite(0x10);
	LCD_DataWrite(0x0E);

	LCD_CtrlWrite(0xDF);			
	LCD_DataWrite(0x21);
	LCD_DataWrite(0x0c);
	LCD_DataWrite(0x02);

	LCD_CtrlWrite(0xF0);   
	LCD_DataWrite(0x45);
	LCD_DataWrite(0x09);
	LCD_DataWrite(0x08);
	LCD_DataWrite(0x08);
	LCD_DataWrite(0x26);
	LCD_DataWrite(0x2A);

	LCD_CtrlWrite(0xF1);    
	LCD_DataWrite(0x43);
	LCD_DataWrite(0x70);
	LCD_DataWrite(0x72);
	LCD_DataWrite(0x36);
	LCD_DataWrite(0x37);  
	LCD_DataWrite(0x6F);


	LCD_CtrlWrite(0xF2);   
	LCD_DataWrite(0x45);
	LCD_DataWrite(0x09);
	LCD_DataWrite(0x08);
	LCD_DataWrite(0x08);
	LCD_DataWrite(0x26);
	LCD_DataWrite(0x2A);

	LCD_CtrlWrite(0xF3);   
	LCD_DataWrite(0x43);
	LCD_DataWrite(0x70);
	LCD_DataWrite(0x72);
	LCD_DataWrite(0x36);
	LCD_DataWrite(0x37); 
	LCD_DataWrite(0x6F);

	LCD_CtrlWrite(0xED);	
	LCD_DataWrite(0x1B); 
	LCD_DataWrite(0x0B); 

	LCD_CtrlWrite(0xAE);			
	LCD_DataWrite(0x77);

	LCD_CtrlWrite(0xCD);			
	LCD_DataWrite(0x63);		


	LCD_CtrlWrite(0x70);			
	LCD_DataWrite(0x07);
	LCD_DataWrite(0x07);
	LCD_DataWrite(0x04);
	LCD_DataWrite(0x0E); 
	LCD_DataWrite(0x10); 
	LCD_DataWrite(0x09);
	LCD_DataWrite(0x07);
	LCD_DataWrite(0x08);
	LCD_DataWrite(0x03);

	LCD_CtrlWrite(0xE8);			
	LCD_DataWrite(0x34);
	/////////////////////////////////////////////
	/*LCD_CtrlWrite(0x60);		
	LCD_DataWrite(0x38);
	LCD_DataWrite(0x0B);
	LCD_DataWrite(0x6D);
	LCD_DataWrite(0x6D);

	LCD_DataWrite(0x39);
	LCD_DataWrite(0xF0);
	LCD_DataWrite(0x6D);
	LCD_DataWrite(0x6D);


	LCD_CtrlWrite(0x61);
	LCD_DataWrite(0x38);
	LCD_DataWrite(0xF4);
	LCD_DataWrite(0x6D);
	LCD_DataWrite(0x6D);

	LCD_DataWrite(0x38);
	//LCD_DataWrite(0xF7);
	LCD_DataWrite(0xF7);
	LCD_DataWrite(0x6D);
	LCD_DataWrite(0x6D);*/
	/////////////////////////////////////
	LCD_CtrlWrite(0x62);
	LCD_DataWrite(0x18);
	LCD_DataWrite(0x0D);
	LCD_DataWrite(0x71);
	LCD_DataWrite(0xED);
	LCD_DataWrite(0x70);
	LCD_DataWrite(0x70);
	LCD_DataWrite(0x18);
	LCD_DataWrite(0x0F);
	LCD_DataWrite(0x71);
	LCD_DataWrite(0xEF);
	LCD_DataWrite(0x70); 
	LCD_DataWrite(0x70);

	LCD_CtrlWrite(0x63);			
	LCD_DataWrite(0x18);
	LCD_DataWrite(0x11);
	LCD_DataWrite(0x71);
	LCD_DataWrite(0xF1);
	LCD_DataWrite(0x70);
	LCD_DataWrite(0x70);
	LCD_DataWrite(0x18);
	LCD_DataWrite(0x13);
	LCD_DataWrite(0x71);
	LCD_DataWrite(0xF3);
	LCD_DataWrite(0x70); 
	LCD_DataWrite(0x70);
	///////////////////////////////////////////////////////
	LCD_CtrlWrite(0x64);			
	LCD_DataWrite(0x3b);
	LCD_DataWrite(0x29);
	LCD_DataWrite(0xF1);
	LCD_DataWrite(0x01);
	LCD_DataWrite(0xF1);
	LCD_DataWrite(0x00);
	LCD_DataWrite(0x0a);

	//??
	LCD_CtrlWrite(0x66);			
	LCD_DataWrite(0x3C);
	LCD_DataWrite(0x00);
	LCD_DataWrite(0xCD);
	LCD_DataWrite(0x67);
	LCD_DataWrite(0x45);
	LCD_DataWrite(0x45);
	LCD_DataWrite(0x10);
	LCD_DataWrite(0x00);
	LCD_DataWrite(0x00);
	LCD_DataWrite(0x00);

	LCD_CtrlWrite(0x67);			
	LCD_DataWrite(0x00);
	LCD_DataWrite(0x3C);
	LCD_DataWrite(0x00);
	LCD_DataWrite(0x00);
	LCD_DataWrite(0x00);
	LCD_DataWrite(0x01);
	LCD_DataWrite(0x54);
	LCD_DataWrite(0x10);
	LCD_DataWrite(0x32);
	LCD_DataWrite(0x98);


					
	LCD_CtrlWrite(0x74);			
	LCD_DataWrite(0x10);	
	LCD_DataWrite(0x68);	// 85// BC
	LCD_DataWrite(0x80);
	LCD_DataWrite(0x00); 
	LCD_DataWrite(0x00); 
	LCD_DataWrite(0x4E);
	LCD_DataWrite(0x00);					

//   LCD_CtrlWrite(0x8d);			
//	LCD_DataWrite(0x03);
	
    LCD_CtrlWrite(0x98);			
	LCD_DataWrite(0x3e);
	LCD_DataWrite(0x07);

	LCD_CtrlWrite(0x99);			
	LCD_DataWrite(0x3e);
	LCD_DataWrite(0x07);


	LCD_CtrlWrite(0x35);	
	LCD_DataWrite(0x00); 
	LCD_CtrlWrite(0x44);			
	LCD_DataWrite(0x00);
	LCD_DataWrite(0xF7);
	LCD_CtrlWrite(0x21);
	Delay(120);
	//--------end gamma setting--------------//

	LCD_CtrlWrite(0x11);
	Delay(120);
	LCD_CtrlWrite(0x29);
	Delay(20);
	LCD_CtrlWrite(0x2C);
	Delay(10);
}
/************************END OF FILE*************************************/


